#ifndef ANYDVDHANDLER_H
#define ANYDVDHANDLER_H

#include <QThread>
#include <QTimer>
#include <QFile>
#include <QHttp>
#include <QProcess>
#include <QStringList>

#include "windef.h"
#include "winver.h"
#include "pelicanows.h"
#include "settings.h"
#include "currentstatus.h"
#include "windowsapi.h"


class AnydvdHandler : public QThread
{
    Q_OBJECT
public:
    AnydvdHandler();
    ~AnydvdHandler();
    bool checkForUpdate();
    QString getVersionDownloaded();
    QString getVersionInstalled();
protected:
    void run();

signals:
public slots:
    void downloadFinish(bool error);
    void startWorking();
    void processStateChanged(QProcess::ProcessState newState );
    void processError ( QProcess::ProcessError error );
    void processFinished ( int exitCode, QProcess::ExitStatus exitStatus );
    void processStarted ();

private:
    void executeUpdate();
    bool downloadUpdaterFile(QString version, QString url, QString fileName);

    QProcess *_process;
    QString _versionDownloading;
    QFile *_file ;
    QHttp *_http;
    bool _downloading;
    bool _readyForInstall;
    QString _path;


    QTimer *timer;
    bool _isWorking;


};

#endif // ANYDVDHANDLER_H
